<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>component v-model</title>
  <script src="/vue.js"></script>
</head>
<body>
  <div id="root">
    <my-input v-model="textValue"></my-input> {{textValue}}
    <div @click="handleClick('a', $event)">click</div>
  </div>
  <script>
    Vue.component('my-input', {
      props: ['value'],
      template: `
        <input 
          type="text" 
          :value="value"
          @input="$emit('input', $event.target.value)"
        >
      `,
      methods: {
        
      },
    })

    var vm = new Vue({
      el: '#root',
      data: {
        textValue: 'hello'
      },
      methods: {
        handleClick(str, e) {
          console.log(e)
        }
      },
    })
  </script>
</body>
</html>